package com.csbr.prod.Controller;

import com.csbr.prod.Dao.AdminDao;
import com.csbr.prod.Pojo.AdminEntity;
import com.csbr.prod.Utils.SendMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class AdminController {

    @Autowired
    private AdminDao adminDao;

    @RequestMapping("/adminLogin")
    public SendMessage fun(@RequestBody AdminEntity jsons){
        Object adlogin=adminDao.findByAdnameAndPassword(jsons.getAdname(),jsons.getPassword());
        if(adlogin==null){
            return SendMessage.Fail("error");
        }
        return SendMessage.Success(adlogin);
    }


}
